package net.pulseproject.router.systemtest;

import static com.objogate.wl.swing.matcher.ComponentMatchers.withButtonText;

import java.awt.Component;

import javax.swing.JButton;

import net.pulseproject.commons.gui.ExceptionDialog;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.objogate.wl.swing.driver.AbstractButtonDriver;
import com.objogate.wl.swing.driver.ComponentDriver;

public class ExceptionDialogDriver extends ComponentDriver<ExceptionDialog> {
	
	private static final Log LOG = LogFactory.getLog(ExceptionDialogDriver.class);
	
	public ExceptionDialogDriver(final ComponentDriver<? extends Component> parentOrOwner,
			final Class<ExceptionDialog> componentType) {
		super(parentOrOwner, componentType);
	}
	
	public final void clickClose() {
		LOG.debug("clickClose()");
		this.clickButtonWithText("Close");
	}

	private void clickButtonWithText(final String buttonText) {
		new AbstractButtonDriver<JButton>(this, the(JButton.class, withButtonText((buttonText)))).click();
	}
	
}
